*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*	This is the Master program for building the Denver analysis file
*	----------------------------------------------------------------------------

	clear all
	set more off
	set maxvar 	120000
	set emptycells drop

*	city

	global city 		DEN

*	paths

	global rawdata 				"${data_raw_DEN}"
	global cleandata 			"${data_clean_DEN}"
	global builddata 			"${data_build_DEN}"

*	sample

	if "$city" == "DEN"{
		local fg	 		6		//first grade
		local lg	 		6		//last grade
		local fy  			2012	//first year
		local ly	  		2018	//last year

		global sectors cmo non_cmo innovation

		local min_enroll	1
		local min_at_risk	1
	}

	local sample "_`fg'_`lg'_`fy'_`ly'"
	local sch_res "_e`min_enroll'_q`min_at_risk'"

*	controls

	global bl_demos bl_female bl_black bl_white bl_hispanic bl_asian bl_fr_lunch bl_sped bl_ell
	global bl_scores bl_math bl_ela bl_math2 bl_ela2 bl_math3 bl_ela3

	global iv_controls "i.year##(i.grade c.($bl_demos) c.($bl_scores))"

*	settings

	local ptype form
	local vtype hom
	local bw

*	switches

	local build 		1		//build analysis file
	local olsvam		1		//estimate OLS-VAM

*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

*	do

	if `build' 	 		do "${code_build}b_build" 				`fg' `lg' `fy' `ly' `min_enroll' `min_at_risk' `bw'

	if `olsvam'			do "${code_build}b_olsvam"				`sample' `sch_res' `vtype' `bw'
